package com.iking.housekeeping.service.dtuser;

import java.util.List;

import com.iking.housekeeping.service.dept.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iking.housekeeping.dao.dtuser.DeptUserMapper;
import com.iking.housekeeping.entity.dtuser.DeptUser;

/**
 * 
 * @author Administrator
 *
 */
@Service
public class DeptUserService {
	
	@Autowired
	private DeptUserMapper deptUserMapper;
	@Autowired
	private DeptService deptService;
	/**
	 * tianji
	 * @param depts
	 * @return
	 */
	public int insertDeptUser(List<DeptUser> depts) {
		
		return deptUserMapper.insertSelectiveList(depts);
	}
	
	/**
	 * 根据部门id查询用户
	 * @param fDeptId
	 * @return
	 */
	public List<DeptUser> selectbyDeptId(String fDeptId){
		return deptUserMapper.selectByDeptId(fDeptId);
	}
	
	/**
	 * 根据用户ID删除用户
	 * @param userId
	 * @return
	 */
	public int delDeptUserByUserId(String userId) {
		return deptUserMapper.delDeptUserByUserId(userId);
	}

	/**
	 * 根据用户ID删除所有用户与组织结构的关联
	 * @param userIdList
	 * @return
	 */
	public int delDeptUserByUserIdList(List<String> userIdList) {
		return deptUserMapper.delDeptUserByUserIdList(userIdList);
	}
	
	/**
	 * 
	 * @Description:根据用户id查部门
	 * @author:CGZ
	 * @param userId
	 * @return
	 */
	public DeptUser selectbyUserId(String userId) {
		return deptUserMapper.selectbyUserId(userId);
	}
	
}
